package com.vdf.sisconsolid.persistencemodule.model;

import java.io.Serializable;
import java.util.Date;
import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 * The persistent class for the person database table.
 * 
 */
@Entity
@Table(name = "person")
public class Person implements Serializable {
	private static final long serialVersionUID = 1L;

	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)
	@Column(nullable = false)
	private Long id;

	@Temporal(TemporalType.DATE)
	@Column(name = "born_date")
	private Date birthday;

	@Column(name = "civil_status")
	private byte civilStatus;

	@Column(length = 10)
	private String document;

	@Column(length = 100)
	private String email;

	@Column(name = "first_name", nullable = false, length = 100)
	private String firstName;

	@Column(name = "last_name", nullable = false, length = 100)
	private String lastName;

	@Column(name = "work_phone", length = 30)
	private String workPhone;

	@Column(name = "personal_phone", length = 30)
	private String personalPhone;

	@Column(length = 1)
	private String sex;

	// bi-directional many-to-one association to Consolidator
	@OneToMany(mappedBy = "person")
	private List<Consolidator> consolidators;

	// bi-directional many-to-one association to Address
	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "id_address")
	private Address address;

	public Person() {
	}

	public Long getId() {
		return this.id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public Date getBirthday() {
		return birthday;
	}

	public void setBirthday(Date birthday) {
		this.birthday = birthday;
	}

	public byte getCivilStatus() {
		return this.civilStatus;
	}

	public void setCivilStatus(byte civilStatus) {
		this.civilStatus = civilStatus;
	}

	public String getDocument() {
		return this.document;
	}

	public void setDocument(String document) {
		this.document = document;
	}

	public String getEmail() {
		return this.email;
	}

	public void setEmail(String email) {
		this.email = email;
	}

	public String getFirstName() {
		return this.firstName;
	}

	public void setFirstName(String firstName) {
		this.firstName = firstName;
	}

	public String getLastName() {
		return this.lastName;
	}

	public void setLastName(String lastName) {
		this.lastName = lastName;
	}

	public String getWorkPhone() {
		return workPhone;
	}

	public void setWorkPhone(String workPhone) {
		this.workPhone = workPhone;
	}

	public String getPersonalPhone() {
		return this.personalPhone;
	}

	public void setPersonalPhone(String personalPhone) {
		this.personalPhone = personalPhone;
	}

	public String getSex() {
		return this.sex;
	}

	public void setSex(String sex) {
		this.sex = sex;
	}

	public List<Consolidator> getConsolidators() {
		return this.consolidators;
	}

	public void setConsolidators(List<Consolidator> consolidators) {
		this.consolidators = consolidators;
	}

	public Address getAddress() {
		return this.address;
	}

	public void setAddress(Address address) {
		this.address = address;
	}

	public String getPrittyName() {
		return firstName + " " + lastName;
	}

}